home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
cad
/
printgl.zip
/
PRINTGL2.DOC
< prev
next >
Wrap
Text File
|
1996-04-02
|
35KB
|
787 lines
PrintGL 1.58 Plotfile Commands and Program Interface
(c) Copyright Ravitz Software Inc. 1990,1996
Ravitz Software Inc. BBS/fax 606-268-0577
PO Box 25068
Lexington, KY 40524-5068 Compuserve Cary Ravitz [70431,32]
USA Internet 70431.32@compuserve.com
------------------------------ Contents ------------------------------
PrintGL Initial Information File ......................... PRINTGL.TXT
PrintGL Documentation File PRINTGL.DOC
Introduction ....................................................... 3
HP-GL Commands 3
HP-GL/2 Commands .................................................. 11
ADI Commands 13
HP-GL Character Sets .............................................. 14
Program Interface 16
p-3
Introduction ---------------------------------------------------------
This document includes a description of the subset of HP-GL
(Hewlett-Packard Graphics Language), HP-GL/2, and ADI (Autodesk
Device Interface) that is supported by PrintGL. If you are using
PrintGL to work with commercial graphics software, then you will
probably not need this information. If you are writing graphics
software you will find here the information needed to make your
output compatible with PrintGL.
The program interface to PrintGL is also documented here.
HP-GL Commands -------------------------------------------------------
PrintGL's HP-GL specification is taken from the programming manuals
for the HP 7475A, ColorPro (7440/17440), and 7550A. The 7550 manual
is the best reference for HP-GL - HP manual 07550-90001. PrintGL
supports the 7475, and 7440/17440 command sets except for character
set 8 (Katakana), digitize commands, output commands, the error mask
command, and some device control commands. Supported commands are
listed below. Commands that are not applicable to printing, such as
pen velocity, are considered supported but are completely ignored.
Commands that are not supported are flagged and then ignored.
In addition, PG, AF, ES, LO, the enhanced IW command, character set
5, and proportional spaced fonts, from the 7550, are supported. And
forty pens are allowed instead of eight.
In reading a plotfile, PrintGL ignores carriage returns, line feeds,
and nulls except where they may be valid characters (LB, SM, DT,
esc.), and ASCII EOF (026) is interpreted as an end of file mark.
AA x_center , y_center , arc_angle [, chord_angle]
Arc absolute - AA moves the pen through an arc, starting at the
current position, with the pen in the current up/down state.
AF
Advance full page - AF starts a new plot. PrintGL starts every
page with the pen up at 0,0.
AP
Automatic pen pickup - IGNORED
AR x_center_delta , y_center_delta , arc_angle [, chord_angle]
Arc relative - AR moves the pen through an arc, starting at the
current position, with the pen in the current up/down state.
AS
Acceleration select - IGNORED
p-4
CA character_set
Designate alternate character set - See HP-GL Character Sets for a
list of character sets.
CI radius [, chord_angle]
Circle - CI draws a circle centered at the current position. The
current up/down state and position are unchanged by a CI command.
CP [spaces , lines]
Character plot - CP moves the pen by character spaces (+ is along
the text) and lines (+ is up), using the current up/down state.
Using no parameters is the same as a carriage return/line feed.
CS character_set
Designate standard character set - See HP-GL Character Sets for a
list of character sets.
CV
Curved line generator - IGNORED
DF
Default values - This sets default values for the following
commands: CA, CS, DR, DT, ES, FT, IW, LO, LT, PA, PT, SC, SM, SL,
SR, SS, TL.
DI [run , rise]
Absolute character direction - DI sets the baseline direction for
labels. The default is 1,0.
DR [run , rise]
Relative character direction - DR sets the baseline direction for
labels. Run and rise are a percentage of P2X-P1X and P2Y-P1Y. The
default is 1,0.
DTt
Define label terminator - The label terminator ends an LB command.
The default is ASCII 003.
EA x_opposite_corner , y_opposite_corner
Edge rectangle absolute - EA draws a rectangle defined by the
current position and the parameters. The pen position and up/down
state are unchanged.
EC
Enable cutter - IGNORED
p-5
EP
Edge polygon - EP draws the current polygon edge. Any pen up/down
used in creating the polygon is respected in drawing the edge.
ER x_opposite_corner_delta , y_opposite_corner_delta
Edge rectangle relative - ER draws a rectangle with corners
defined by the current position and the command parameters. The
current pen position and up/down state are unchanged.
ES [ space [, line]]
Extra space - ES adds to the space between characters and lines.
The units are in character cells (1.5*width, 2*height). The
allowed range is -1 to 1. -.3333 causes characters to touch.
EW radius , start_angle , sweep_angle [, chord_angle]
Edge wedge - EW draws a wedge centered at the current position.
The current pen position and up/down state are unchanged.
FP
Fill polygon - FP fills the current polygon. Pen up/down commands
used in creating the polygon are ignored.
There is a limit of 4000 fill line segments per polygon.
FS
Force select - IGNORED
FT [type [, spacing [, angle]]]
Fill type - These are the fill types. Type 2 is identical to type
1 for PrintGL.
1 solid lines spaced at half the pen thickness (see PT command)
2 unidirectional solid lines spaced at half the pen thickness
3 lines at the specified spacing
4 cross hatched lines at the specified spacing
5 type ignored
A spacing parameter of 0 sets the spacing to 1% of the P1-P2
diagonal. Spacing is in x axis units (this is only relevant if the
axes have different scaling). PrintGL supports any integer angle
for fill. Cross hatched lines are at angle + 90.
GM
Graphics Memory - IGNORED
IN
Initialize
p-6
IP [p1x , p1y [, p2x , p2y]]
Sets scaling points P1 and P2 - IP sets the scaling points (P1 and
P2) in plotter units. P1 and P2 are used by several commands to
help with size independent plots.
IW [x_lower_left , y_lower_left , x_upper_right , y_upper_right]
Input window - IW sets a clipping window in plotter units. With no
parameters, the clipping window is turned off.
If PrintGL's /YE switch is set and user scaling is on then IW
parameters are in user units. In this case the window is rescaled
with an IP command, but any SC command locks the current window.
LB..text..terminator
Label - Labels use the current character set, based on CA, CS, SA,
and SS commands. See HP-GL Character Sets for font specifics.
LO [ position_number ]
Label origin - LO sets the label origins, shown below. For
positions 4..9 and 14..19 the label buffer is limited to 150
characters. The default is 1.
13 16 19
3...... ....... ...6... ....... ......9
. . . . . . . . . .
12 2 . . . . 5 . . . . 8 18
. . . . . . . . . .
1...... ....... ...4... ....... ......7
11 14 17
LT [pattern_number [, pattern_length]]
Line type - PrintGL's line type patterns are close to, but not
identical to HP's. Pattern length is a percentage of the P1-P2
diagonal with a default of 4% and a minimum of 4 dots for types 1
and 2 and 16 dots for other types. Negative (adaptive) line types
from the HP 7550 are supported.
no parameter solid 1 . .
2 ________ ________
0 dots at 3 ____________ ____________
endpoints 4 ____________ . ____________ .
only 5 __________ __ __________ __
6 ______ __ __ ______ __ __
7 __________ . . __________ . .
8 ______ . __ . ______ . __ .
PA [x , y] [, x , y] ...
Plot absolute - PA sets absolute mode and optionally moves the pen
in the current up/down state.
p-7
PD [x , y] [, x , y] ...
Pen down - PD sets the pen down and optionally moves it with the
current absolute/relative mode.
PG [i]
New page - PG starts a new plot. The parameter is ignored. PrintGL
starts every page with the pen up at 0,0.
PM i
Polygon mode - PM 0 starts polygon mode. The current position is
the first point in the polygon.
PM 1 starts a new subpolygon. The position after the next pen
movement is the first point in the subpolygon. The first pen move
of a subpolygon is done with the pen up, regardless of the current
up/down status.
PM 2 ends polygon mode.
PM 1 and PM 2 close the current subpolygon with the current pen
up/down state. If used without first starting polygon mode (PM 0),
PrintGL adds an implied PM 0 before processing the PM 1 or PM 2.
The following commands are accepted in polygon mode: PM, PA, PR,
PU, PD, AA, AR, CI (circles are automatically prefixed and
suffixed by PM 1), and IN.
The polygon buffer is limited to 1000 data points.
PR [x_delta , y_delta] [, x_delta , y_delta] ...
Plot relative - PR sets relative mode and optionally moves the pen
in the current up/down state.
PS
Paper size - IGNORED
PrintGL ignores PS. The paper size must be set with the /L option.
PT [thickness]
Pen thickness - PT specifies twice the line spacing used in solid
fills and may be from 0 to 5.0 mm. It is reset to .3 mm with each
SP command.
PU [x,y] [,x,y] ...
Pen up - PU raises the pen and optionally moves it with the
current absolute/relative mode.
p-8
RA x_opposite_corner , y_opposite_corner
Shade rectangle absolute - RA fills a rectangle with corners
defined by the current position and the command parameters. The
current pen position and up/down state are unchanged. The
rectangle edge is not drawn.
RO [angle]
Rotate coordinate system - RO or RO0 sets up a normal coordinate
system. RO90, the only other allowed value, sets up a system that
is rotated 90 degrees. The type of rotation depends on the paper
size. This command does not change the scaling points, so an IP
command is useful after an RO.
The HP 7475 specifies two different meanings for RO90 depending on
the paper size (A/A4 or B/A3). PrintGL decides which type of
rotation to do based on the sum of the print window width and
height. If this sum is greater than 24 inches then large paper
rotation is used. Otherwise, small paper rotation is used.
Small paper rotation: Large paper rotation:
RO 0 RO 90 RO 0 RO 90
y -------- 0,0 -------- y 0,0 -------- y y --------
| | | | | | | |
| | | | | | | |
0,0 -------- x x -------- | | | |
| | | |
| | | |
| | | |
x -------- 0,0 -------- x
RR x_opposite_corner_delta , y_opposite_corner_delta
Shade rectangle relative - RR fills a rectangle with corners
defined by the current position and the command parameters. The
current pen position and up/down state are unchanged. The
rectangle edge is not drawn.
SA
Select alternate character set - SA specifies the alternate
character set as current. The alternate character set is chosen
with CA.
SC [xmin , xmax , ymin , ymax] or SC xmin,xrto,ymin,yrto,2
Scaling - SC sets user units. The units are defined by user values
for P1 (xmin,ymin) and P2 (xmax,ymax) or P1 and the ratio of
plotter to user units. Using no parameters turns scaling off, and
subsequent drawing is done in plotter units (1/1016 inch).
p-9
SI [width , height]
Character size absolute - SI sets the capital letter box width and
height in centimeters. Letter spacing is 1.5 * width and line
spacing is 2 * height. Using no parameters with B or A3 paper is
the same as SI.285,.375 and any other paper is the same as
SI.187,.269.
SL [tan_angle]
Character slant - SL sets the character slant. The parameter is
interpreted as the tangent of the angle from vertical. Using no
parameter sets the slant to 0 degrees.
SM[c]
Symbol mode - SM sets symbol mode, which centers the symbol mode
character at any plotted point. Any character from ASCII 033 to
127 except ";" sets symbol mode. Any other character turns symbol
mode off.
SP pen_number
Select pen - SP selects a pen. Using 0 or no parameter stores the
pen without selecting a new pen. This is usually done at the end
of a plot. PrintGL ignores any drawing with pen 0.
SR [width , height]
Character size relative - SR sets the capital letter box width and
height as a percentage of P2X-P1X and P2Y-P1Y. Letter spacing is
1.5 * width and line spacing is 2 * height. Using no parameters is
the same as SR.75,1.5.
SS
Select standard character set - SS specifies the standard
character set as current. The standard character set is chosen
with CS.
TL [positive_length [, negative length]]
Tick length - TL sets the tick lengths used by XT and YT. The
parameters are lengths above and below the current position as a
percentage of P2Y-P1Y for x-axis ticks and a percentage of P2X-P1X
for y-axis ticks.
UC [[pen_control ,] x_delta , y_delta] ...
User character - UC specifies a user defined character. The pen
control number is 99 for pen down or -99 for pen up. Pen movements
are relative, with x_delta in units of 1/4 the character width and
y_delta in units of 1/8 the character height.
VA
Adaptive velocity - IGNORED
p-10
VN
Normal velocity - IGNORED
VS
Pen velocity - IGNORED
WG radius , start_angle , sweep_angle [, chord_angle]
Shade wedge - WG fills a wedge centered at the current position.
The current pen position and up/down state are unchanged. The
wedge edge is not drawn.
XT
X-axis tick - XT draws a vertical line, with length specified by
the TL command, at the current position. The pen position and
up/down state are unchanged.
YT
Y-axis tick - YT draws a horizontal line, with length specified by
the TL command, at the current position. The pen position and
up/down state are unchanged.
esc.(
esc.Y
Plotter on - Esc.( and esc.Y turn the plotter on. This is only
relevant with the /YY option.
esc.)
esc.Z
Plotter off - Esc.) and esc.Z turn the plotter off. They are only
effective with the /YY option. The plotter on and off commands let
you include comments or data to pass through to another device in
the plotfile. These are flagged as unsupported commands if /YD is
set, as an indication that you should set /YY.
esc.@, esc.H, esc.I, esc.M, esc.N, esc.R
RS-232 device control commands - IGNORED
p-11
HP-GL/2 Commands -----------------------------------------------------
PrintGL's HP-GL/2 commands include a subset of HP-GL/2 that lets you
take advantage of HP-GL/2's pen control and data compression.
PrintGL's HP-GL/2 interpreter reads all of the HP-GL commands above,
except as noted below. PrintGL acts like an HP-GL/2 plotter, not
printer, so form feeds are done with the PG command not the form
feed character.
The LA command is not supported - all lines are drawn with round
ends and round joints. And all clipping is done to the line center.
When the output format is HP-GL all of the HP-GL/2 extended pen
control commands are ignored. The PT command is needed to ensure
solid fills look good.
AC [x , y]
Anchor corner - AC specifies the origin of stroked fills. It is
handled even with HP-GL/2 off.
BP
Begin plot - BP is interpreted as PG;IN;. It is handled even with
HP-GL/2 off.
CO "comment"
Comment - This is handled even with HP-GL/2 off.
CR [black_ref_red , green , blue , white_ref_red , green , blue]
Color range - Sets the color ranges used by the PC command.
DTt[, mode]
Define label terminator - The HP-GL/2 mode parameter (0 print
terminator, 1 do not print terminator) is handled even if HP-GL/2
is turned off.
FT [type [, spacing or shading [, angle]]]
Fill type - When reading HP-GL/2, PrintGL accepts type 10 (shading
percentage is the additional parameter) and 11 (raster fill number
is the additional parameter). Type 11 fills are converted to type
10 with the shade level taken from the RF command.
For solid and shaded fill types, to guarantee good results, you
must use the PW command to set the pen width and this width must
magnify to no more than 24 dots in the final image. If either of
these rules is broken, the fill may be striped rather than solid.
IR [p1x , p1y [, p2x , p2y]]
Set scaling points relative - This is handled even if HP-GL/2 is
turned off.
p-12
LT [pattern_number [, pattern_length, [mode]]]
Line type - HP-GL/2 allows the additional parameter to select
relative (default) or absolute (in mm) pattern lengths. This is
handled even with HP-GL/2 off.
NP [number]
Number of pens - Sets the number of pens. This is ignored by
PrintGL, which can handle up to 256 pens.
PC [pen [, red , green , blue]]
Pen color - Sets the pen color.
PE
Polyline encoded - This starts PE mode. It is handled even with
HP-GL/2 off.
PT [thickness]
Pen thickness - The command is not part of HP-GL/2 and is
generally ignored. If the output format is HP-GL or if you are
using /Y1 (HP-GL/2 without pen control) then PT is interpreted as
it is in HP-GL.
PW [width [, pen]]
Pen width - Sets the pen width. After magnification, the maximum
width is 24 dots. PW is ignored if the output format is HP-GL.
QL
Quality level - IGNORED for HP-GL or HP-GL/2
RF [index [,width, height, pen [.. pen]]
Raster fill - RF is not fully implemented. Instead it is read and
the pattern is converted to a shade level. Pen numbers and the
specific pattern are ignored. The shade level is saved for use
with fill type 11.
RO [angle]
Rotate coordinate system - When reading HP-GL/2, this command
accepts 0, 90, 180, and 270 and always rotates counter-clockwise.
SV [type [, option1 [, option2]]]
Screened vectors - Sets the shade level used to draw lines. Only
modes 0 and 1 are supported.
TR [mode]
Transparency mode - Sets opaque or translucent mode.
p-13
UL [index [,gap1, .., gapn]]
User line type - UL is not fully implemented. Instead it is read
and the pattern is converted to one of PrintGL's eight standard
line types. The gaps must be less that 256.
WU [type]
Width units - Sets the units used by the PW command.
esc% .. A
Enter PCL or RTL mode - This command is treated like esc.). All
commands are ignored until the next esc% .. B.
esc% .. B
Enter HP-GL/2 mode - This command is treated like esc.(. It is
required before any commands are interpreted.
ADI Commands ---------------------------------------------------------
With the /YA option PrintGL can read Autodesk ADI 4.0 vector plotter
binary commands intermixed in the HP-GL. 1016 dpi coordinates or the
current HP-GL user coordinates are assumed. The table shows each ADI
command and the equivalent HP-GL command (as interpreted by
PrintGL). In the ADI code column, the code number and "b"s are
bytes, and "x" and "y" are words. Eight line types (other than
solid) are supported.
ADI command ADI code equivalent HP-GL
begin plot 1 b ignored
end plot 2 PG;
move 3 x y PUx,y;
draw 4 x y PDx,y;
pen 5 b SPb;
speed 6 b ignored
line type 7 b if b=0 then LT; else LTb,2;
raise pen 8 ignored
abort 9 ignored
p-14
HP-GL Character Sets -------------------------------------------------
PrintGL supports all of the character sets that are included with
the HP 7475 and 7440/17440 except Katakana, and adds character set 5
and the proportional spaced fonts from the 7550. PrintGL's
characters are similar to but not identical to HP's.
0 ANSI ASCII 30 ISO Swedish
1 9825 character set 31 ISO Swedish For Names
2 French/German 32 ISO Norway Version 1
3 Scandinavian 33 ISO German
4 Spanish/Latin American 34 ISO French
5 Special Symbols (7550 extension) 35 ISO United Kingdom
6 JIS ASCII 36 ISO Italian
7 Roman Extensions 37 ISO Spanish
8 Katakana - NOT SUPPORTED 38 ISO Portuguese
9 ISO IRV 39 ISO Norway Version 2
The character sets specify a font for codes 033..127. Codes 000..032
and 128..255 are independent of the character set and are all no ops
except these.
003 default label terminator
008 backspace 013 carriage return
009 half backspace 014 select alternate character set
010 line feed 015 select standard character set
011 reverse line feed 032 space
Each of the character sets is available as a proportional font by
adding 10 to the set number. The proportional fonts are kerned to
improve appearance (the character spacing is adjusted to compensate
for character shape). Use the LO command to simplify working with
proportional fonts. To improve the appearance of large text, use the
ES command to reduce the character spacing.
Codes 65 to 81 in character set 5 are symbols designed to be used in
symbol mode (SM command) or as one character labels. When used in a
label (LB command) these characters are centered at the current pen
position and leave the pen position unchanged.
continued
p-15
The HP-GL characters cannot be printed with the standard ASCII
character set. The file PRINTGL2.CHR is an HP-GL file that can be
used to print a replacement for this page, showing the character
sets. Set up PrintGL with "magnification" "magnify: 1.0", "position"
"plot: 0.0,0.0 at print origin", and "window/margins" "default" to
print this plotfile.
p-16
Program Interface ----------------------------------------------------
The following information lets you integrate PrintGL into your
program to print or display plotfiles. This information is provided
for experienced programmers only - no user help will be provided.
You may not distribute PrintGL as part of another product or on the
same disk with any commercial software (see License). Contact Ravitz
Software Inc. to inquire about special distribution licenses.
To extend the PrintGL setup string, set up multiple strings that
include only complete options. Include in each string except the
last the option /&next_segment, next_offset to point to the next
string. This links the strings together so that PrintGL can read all
of the strings.
PrintGL can use your keyboard/mouse input routine instead of
accessing BIOS or Windows directly. To use this feature add the
segment and offset of your keyboard routine to the /X option. The
routine must be a far routine that receives one word parameter on
the stack and pops the stack on return (Pascal convention). The
parameter will be:
0 - routine returns 1 if a key is ready or 0 if no key is ready
1 - routine waits for a key and returns it
100 - PrintGL has returned to text mode
101 - PrintGL has entered APA screen mode
102 - PrintGL has opened a destination file
110 - PrintGL return code is 0 (success)
111 - PrintGL return code is 1 (failed)
112 - PrintGL return code is 2 (user break)
Return values should be put in ax. Keystroke values should be
identical to those returned by the keyboard BIOS.
100 and 101 let your program know what is on the screen. 102 lets
you can count how many destination files are created. No return
value is expected.
PrintGL can also use your screen output routine instead of accessing
DOS or WIndows. To use this feature add the segment and offset of
your output routine to the /X option. If you are using PrintGL's
keyboard routine, precede it with "0,0,". The routine must be a far
routine that receives one pointer on the stack and pops the stack on
return. The pointer will point to a length delimited string (Pascal
string). No return information is expected. This routine only
receives PrintGL's text data, not it graphics display data.
You will need to switch to your data segment to access global
variables from these routines. If you add your data segment as the
fifth number in the /X option then PrintGL will set this before it
does a callback. If you want to use this feature but not your own
screen output routine, insert "0,0," instead of the routine address.
continued
p-17
PrintGL can read plotfiles files or call your program to receive
data. To set up a callback routine to transfer data, add /G
segment,offset to the parameter list to specify the address of the
routine.
This routine should, in general, switch to your data segment, your
stack if you need more than 1K, and your program prefix segment and
dta if you are using DOS file access in the middle of a callback.
You can have PrintGL automatically switch to your data segment by
adding it as the third numeric parameter to the /G option. In this
case, wherever ds would set be as documented below, es is instead
set.
All parameters are transferred via register. The callback routine
will be called with these parameters:
open file
ax = $3d00
cx = 0
dx = offset of filename
ds = segment of filename (filename is null delimited string)
returns handle in ax, sets carry flag on error
Since you set the filename in the PrintGL parameter list, it is
not important. The returned handle is also not important.
close file
ax = $3e00
bx = handle
read data
ax = $3f00
bx = handle
cx = amount of data desired
dx = offset of buffer to load data
ds = segment of buffer to load data
returns amount of data loaded in ax (must be <= cx and >= 1),
sets carry flag on error
You can return as little as 1 byte of data or as much as cx.
Setting the program prefix segment is accomplished via these
undocumented DOS calls (int $21)
ax = $5100 returns psp in bx
ax = $5000 and bx = psp sets the psp.